![]() |
Java Database Programming with JDBC
by Pratik Patel Coriolis, The Coriolis Group ISBN: 1576100561 Pub Date: 10/01/96 |
Previous | Table of Contents | Next |
We need to call this applet from an HTML file, which is shown in Listing 4.10. We dont pass in any properties, but we could easily include a default data source URL and user name that the applet would read in before initializing the user interface, and then set the appropriate TextField to show these defaults. Note that we set the width and height carefully in the <APPLET> tag. This is to make sure that our applets user interface has enough room to be properly laid out.
Listing 4.10 HTML code to call the interactive query applet.
<HTML> <HEAD> <TITLE>JDBC Client Applet - Interactive SQL Command Util</TITLE> </HEAD> <BODY> <H1>Interactive JDBC SQL Query Applet</H1> <hr> <applet code=IQ.class width=450 height=350> </applet> <hr> </BODY> </HTML>
Figure 4.3 shows a screen shot of the completed applet, and Figure 4.4 shows the applet running. Not too shabby for our first try. Weve covered a lot of ground in creating this applet, so lets take some time to recap the important details. We learned how to:
Figure 4.3 The completed Interactive Query applet.
Figure 4.4 The Interactive Query applet running.
To use the applet, you can load the HTML file in a Java-enabled Web browser, or you can start the applet from the command line:
bash$ appletviewer IQ.html &
Dont forget, if you have problems finding the class file or the driver, set the CLASSPATH. See Chapter 3 for more help on this topic.
In the next chapter, well explore the bridge between ODBC and JDBC. Youll see how easy it is to use existing ODBC drivers with JDBC, and learn some of the fine points of the relation, similarity, and difference between the two database connectivity standards. You wont want to miss this one; the author, Karl Moss, is also the author of the Sun/Intersolv ODBC-JDBC bridge included in the JDBC package.
Previous | Table of Contents | Next |